package com.zaixiandiancan.xia.serviceImpl;

import java.util.List;

import com.zaixiandiancan.xia.dao.UserDao;
import com.zaixiandiancan.xia.entity.User;
import com.zaixiandiancan.xia.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    @Transactional
    public List<User> searchUserAll() {
        try {
            return userDao.searchUserAll();
        } catch (Exception e) {
            System.out.println(e.getMessage());
            return null;
        }

    }

    @Override
    @Transactional
    public List<User> searchUserByName(User user) {
        try {
            return userDao.searchUserByName(user);
        } catch (Exception e) {
            System.out.println(e.getMessage());
            return null;
        }
    }

    @Override
    @Transactional
    public boolean addUser(User user) {
        try {
            return userDao.addUser(user);
        } catch (Exception e) {
            System.out.println(e.getMessage());
            return false;
        }
    }

    @Override
    @Transactional
    public boolean updateUserPassWord(User user) {
        try {
            return userDao.updateUserPassWord(user);
        } catch (Exception e) {
            System.out.println(e.getMessage());
            return false;
        }
    }

}
